package com.zcl.tool.thread;

/**
 * Created with IntelliJ IDEA.
 *
 * @author 14612
 * @Auther: zhanchenlei
 * @Date: 2021/06/30/14:32
 * @Description:继承thread的两种写法
 */
public class ThreadDemo {

    // 继承Thread类 写法1
    static class MyThread extends Thread{
        @Override
        public void run() {
            //要实现的业务代码
            System.out.println("继承thread了");
        }
    }
    // 写法2
    Thread thread = new Thread(() -> {
        //
        System.out.println("写法2打印");
    });
    public static void main(String[] args) {
        //休眠1000毫秒之后打印
        ThreadDemo threadDemo = new ThreadDemo();
        threadDemo.thread.start();
    }
}
